package com.ms.p2p.provider.impl;


import com.alibaba.dubbo.config.annotation.Service;
import com.ms.p2p.bean.PageBean;
import com.ms.p2p.dao.RbacDao;
import com.ms.p2p.entity.system.RbacDept;
import com.ms.p2p.entity.system.RbacDeptRole;
import com.ms.p2p.entity.system.RbacRole;
import com.ms.p2p.provider.RbacProvider;
import com.ms.p2p.service.impl.RbacServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by daimajia on 2015/4/19 添加dubbo接口.
 */
@Service
public class RbacProviderImpl implements  RbacProvider{
    @Autowired
    RbacServiceImpl rbacService;


    public List findDepts() {
        return rbacService.findDepts();
    }

    public void deleteByDeptAndRoles(String deptid, String[] role) {
        rbacService.deleteByDeptAndRoles(deptid,role);


    }

    public List<RbacRole> findDeptRolesByPid(int dept_id, String pid) {
        return rbacService.findDeptRolesByPid(dept_id,pid);
    }

    public int findCount() {
        return rbacService.findCount();
    }

    public List<HashMap<String, Object>> findPager(PageBean page) {
        return rbacService.findPager(page.getBegin(),page.getPageSize());
    }

    public void saveOrupdate(String id, String name) {
        rbacService.saveOrUpdate(id,name);
    }


    public List<Map<String, Object>> getRoles(String deptid) {
        return rbacService.getRoles(deptid);
    }




    public RbacDept selectDeptByid(String id) {
        return rbacService.selectDeptByid(id);
    }




    public boolean checkPremission(Integer id, String premission) {
        return rbacService.checkPremission(id,premission);
    }

    public List<Map<String, Object>> getPager(PageBean page) {
        return rbacService.getPager(page);
    }
}
